Conditions | 2 |
Total Lines | 18 |
Code Lines | 17 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | import { |
||
27 | |||
28 | @Post() |
||
29 | @ApiOperation({title: 'Create new quote'}) |
||
30 | public async index( |
||
31 | @Body() quoteDTO: CreateQuoteDTO, |
||
32 | @LoggedUser() user: User |
||
33 | ) { |
||
34 | try { |
||
35 | const {projectId, customerId, status, items} = quoteDTO; |
||
36 | const id = await this.commandBus.execute( |
||
37 | new CreateQuoteCommand(user, status, customerId, projectId) |
||
38 | ); |
||
39 | |||
40 | await this.commandBus.execute(new CreateQuoteItemsCommand(id, items)); |
||
41 | |||
42 | return {id}; |
||
43 | } catch (e) { |
||
44 | throw new BadRequestException(e.message); |
||
45 | } |
||
48 |